<?php

namespace App\Modules\Diagnose\Services;

use  App\Modules\Diagnose\Models\OrderDiagnose;

class OrderDiagnoseService
{

    public static function getList($data=[]) {
        return OrderDiagnose::getList($data);
    }


    public static function getDetails($id){
        return OrderDiagnose::getDetails($id);
    }


    public static function add($data=[]){
        return OrderDiagnose::add($data);
    }

    /**
     * 根据订单号查询
     * @param $trade_no
     * @return mixed
     */
    public static function findByTradeNo($trade_no) {
        return OrderDiagnose::where('trade_no', $trade_no)->first();
    }

    /**
     * 获取已支付但未使用的订单
     * @param $uid
     * @param $type
     * @return mixed
     */
    public static function getUserPaidNotUsed($uid,$type) {
        return OrderDiagnose::where('user_id',$uid)
            ->where('diagnose_type',$type)
            ->where('is_used',0)
            ->first();
    }
}